<template>
  <zm-view ref="view" background="#F4F6F7">
    <!-- 倒计时 -->
    <!-- #ifndef WEB -->
    <zm-navbar :is-back="true" :border-bottom="false" background="#F4F6F7">
      <view class="font-34 font-bold">确认订单</view>
      <view slot="right" class="flex items-center">
        <u-image src="/zuimei-film-oss/1.0.0/icons/icon-time.png" width="26rpx" height="26rpx" ext-class="mr-14"></u-image>
        <u-count-down :time="orderInfo.autoTime * 1000" format="mm:ss" @finish="timeFinish"></u-count-down>
      </view>
    </zm-navbar>
    <!-- #endif -->
    <!-- 影片信息 -->
    <view class="ticket bg-white radius-16 mr-24 ml-24 mt-20 mb-20">
      <view class="ticket-detail pt-28 pl-22 pr-22 pb-22 flex">
        <view class="mr-18">
          <u-image width="156rpx" height="224rpx" radius="10rpx" :src="orderInfo.cover"></u-image>
        </view>
        <view class="font-24 text-666 flex-1">
          <!-- #ifdef WEB -->
          <view class="flex items-center justify-end mb-10">
            <u-image src="/zuimei-film-oss/1.0.0/icons/icon-time.png" width="26rpx" height="26rpx" ext-class="mr-14  ml-auto"></u-image>
            <u-count-down :time="orderInfo.autoTime * 1000" format="mm:ss" @finish="timeFinish"></u-count-down>
          </view>
          <!-- #endif -->
          <view class="mb-10 flex items-center">
            <view class="font-36 font-bold text-333 text-row-1 flex-1 mr-10"> {{ orderInfo.filmName }}</view>
            <view class="ml-auto">共{{ ticketNum }}张 原价￥{{ originPrice }}</view>
          </view>
          <view class="flex mb-10">
            <view class="mr-10">{{ orderInfo.sDate | formatDayWeekDesc }} {{ orderInfo.sDate | formatDate("MM-DD") }} {{ orderInfo.sTime }}~{{ orderInfo.eTime }}</view>
            <view v-if="orderInfo.copyLanguage">({{ orderInfo.copyLanguage }})</view>
          </view>
          <view class="mb-10">{{ orderInfo.hallName }}{{ orderInfo.seatDescribe }}</view>
          <view class="mb-10 text-row-1">{{ orderInfo.cinemaName }}</view>
          <view class="mb-10 text-row-1">{{ orderInfo.cinemaInfo.address }}</view>
        </view>
      </view>
      <view v-if="channelInfo.isRefundTag == 1" class="refund-tips flex items-center justify-between p-26">
        <view class="lint"></view>
        <view class="flex items-center">
          <view class="flex items-center mr-30">
            <zm-icon name="clear" size="28rpx" :color="themeColor"></zm-icon>
            <view class="font-bold ml-8">不支持退票</view>
          </view>
          <view class="flex items-center">
            <zm-icon name="clear" size="28rpx" :color="themeColor"></zm-icon>
            <view class="font-bold ml-8">不支持改签</view>
          </view>
        </view>
        <zm-icon-text
          name="arrow"
          text="退改签须知"
          text-left
          weight="bold"
          text-color="#666"
          color="#999"
          size="28rpx"
          custom-class="click-animation"
          @click="backEditVisible = true"
        ></zm-icon-text>
      </view>
    </view>
    <!-- 卡券选择栏 -->
    <view v-if="hasCoupon || hasCard" class="mx-24 mb-20">
      <deduct-cell
        ref="discount"
        :coupon-count="couponCount"
        :card-can-use-num="cardCanUseNum"
        :order-info="orderInfo"
        :has-coupon="hasCoupon"
        :has-card="hasCard"
        :discount-list="orderInfo.discountList"
        :check-card-num="cardInfo.cardId ? 1 : 0"
        :check-coupon-num="coupons.length"
        :pre-info="preInfo"
        @choose-cell="handleChooseCell"
        @question="handleQuestion"
      >
        <!-- 开通vip轮播栏 -->
        <open-vip-card
          v-if="openVipVisible && channelInfo.preReview != 1"
          slot="header"
          :data="openVipInfo"
          :rule-id="checkVipCardV2Info.ruleId"
          custom-class="pb-18"
          @check="handleOpenVipCheck"
        ></open-vip-card>
      </deduct-cell>
    </view>
    <!-- 手机号 -->
    <view class="bg-white radius-16 p-24 flex items-center mx-24 mb-20" @click="showMobileDialog = true">
      <view class="flex flex-1 mr-24">
        <u-image width="70rpx" height="70rpx" src="/zuimei-film-oss/1.0.0/icons/icon-phone.png"></u-image>
        <view class="ml-16 flex flex-col">
          <text class="font-28 text-333">{{ orderInfo.lockMobile }}</text>
          <text class="font-26 text-666">手机号仅用于短信取票码，不收取服务费</text>
        </view>
      </view>
      <zm-icon name="arrow" size="28rpx" weight="bold" color="#999"></zm-icon>
    </view>
    <!-- 购票须知 -->
    <view class="bg-white radius-16 px-30 pt-24 pb-40 mx-24 mb-20">
      <view class="font-32 font-bold pb-18 solid-bottom-2 mb-20">购票须知</view>
      <zm-richtext :content="channelInfo.buyFilmExplain"></zm-richtext>
    </view>
    <!-- 底部按钮 -->
    <zm-footer safe-area-inset-bottom background="#fff" z-index="100" @height="onFooterHeight">
      <view class="flex items-center p-24">
        <view class="mr-auto font-40 font-bold text-price-mini-before text-price">{{ allNeedPayPrice }}</view>
        <view class="flex items-center text-999 font-26 mr-20 detail-btn" @click="lookDetail">
          <view class="mr-10"> 明细</view>
          <view class="transition" :class="{ 'transform-rotate-180': detailVisible }">
            <u-icon name="arrow-up-fill" size="8" color="#9999"></u-icon>
          </view>
        </view>
        <zm-button :disabled="payButtonDisabled" width="290rpx" height="88rpx" text-size="30rpx" text-weight="bold" type="primary" round @click="submitPay">{{ payButtonText }}</zm-button>
      </view>
    </zm-footer>
    <!-- 订单详情展示 -->
    <zm-popup z-index="10" :scroll-y="false" closeable height="600rpx" :show.sync="detailVisible" mode="bottom" border-radius="24rpx">
      <view class="order-detail-wrap pl-24 pr-24">
        <view class="order-detail_title text-333 font-32 font-bold text-center mb-30 pt-32">明细价格</view>
        <order-detail-cell :pre-info="preInfo"></order-detail-cell>
      </view>
    </zm-popup>
    <!-- 退改签底部弹窗 -->
    <zm-popup mode="bottom" z-index="10" border-radius="24rpx" :background="useColor('page')" :show.sync="backEditVisible" closeable>
      <view slot="header" class="font-32 font-bold text-center py-30">退改签详情</view>
      <view class="px-24 font-26" :style="{ 'padding-bottom': footerHeight + 'px' }">
        <view class="flex flex-col p-24 radius-16 mb-20 bg-white">
          <view class="font-32 font-bold mb-20">退票规则</view>
          <text class="text-666">本影院暂不支持退票</text>
        </view>
        <view class="flex flex-col p-24 radius-16 mb-20 bg-white">
          <view class="font-32 font-bold mb-20">改签规则</view>
          <text class="text-666 mb-5">本影院暂不支持改签</text>
        </view>
        <view class="flex flex-col p-24 radius-16 mb-20 bg-white">
          <view class="font-32 font-bold mb-20">特别提醒</view>
          <view class="flex items-center mb-12">
            <text>1、点击查看</text>
            <text class="text-666 mb-5 text-theme click-animation" @click="handleToBackEditAt">《退改签服务协议》</text>
          </view>
          <text class="text-666 mb-12">2、仅限整单退改签，不支持分座位退改签</text>
          <text class="text-666">3、若订单享受支付活动，不支持退改签</text>
        </view>
      </view>
    </zm-popup>
    <!-- 退改签协议弹窗 -->
    <zm-dialog
      :show.sync="backEditDialogVisible"
      title="退改签协议规定"
      show-cancel-button
      cancel-button-text="暂不购票"
      :confirm-button-text="isAgreest ? '已阅读并同意' : '继续购票'"
      async-close
      @confirm="onBackEditDialogConfirm"
      @cancel="onBackEditDialogCancel"
    >
      <zm-richtext :content="channelInfo.refundExplain"></zm-richtext>
      <zm-checkbox v-model="isAgreest" icon-size="28rpx" round custom-class="mt-20">
        <view class="checkbox-text">
          <text> 我已阅读并同意 </text>
          <text class="text-theme" @click.stop="handleToBackEditAt">《{{ baseInfo.priSubject || manifest.name }}退票改签用户服务协议》</text>
        </view>
      </zm-checkbox>
    </zm-dialog>
    <!-- 支付组件 -->
    <pay-way-popup ref="pay" :has-balance-pay="balancePay" :has-integral-pay="integralPay"> </pay-way-popup>
    <!-- 手机号修改 -->
    <zm-dialog :show.sync="showMobileDialog" title="修改手机号" show-cancel-button @cancel="showMobileDialog = false" @confirm="handleConfirmMobile">
      <view class="w-full bg-page p-24 radius-12">
        <u-input v-model="newMobile" border="none" placeholder="请输入手机号" type="number" maxlength="11"></u-input>
      </view>
    </zm-dialog>
    <!-- 首单立减折扣说明弹框 -->
    <zm-popup :show.sync="questionVisible" mode="center" :safe-area-inset-bottom="false" width="622rpx">
      <view class="p-40">
        <view class="fb mb-36 font-32 text-center">会员每月首单立减</view>
        <view v-for="(item, index) in questionList" :key="index" class="font-28 text-666 mb-10">{{ item }}</view>
        <view class="flex justify-center w-full">
          <zm-button height="70rpx" width="220rpx" text-size="28rpx" round @click="questionVisible = false">确定</zm-button>
        </view>
      </view>
    </zm-popup>
    <!-- vip首单优惠选择 -->
    <zm-popup mode="bottom" height="500rpx" z-index="100" border-radius="24rpx" :background="useColor('page')" :show.sync="vipDiscountVisible" :close-on-click-overlay="false">
      <view slot="header" class="font-32 font-bold text-center py-30">会员每月首单立减</view>
      <u-radio-group v-model="vipForm.vipFirstDiscount" icon-placement="right" custom-class="flex-wrap px-34">
        <u-radio name="0" size="40rpx" :active-color="useColor('theme')" custom-class="w-full py-20">
          <view class="font-28 text-333 font-600">不使用优惠</view>
          <zm-icon slot="icon" name="check" color="#fff" size="28rpx" weight="bold"></zm-icon>
        </u-radio>
        <u-radio name="1" size="40rpx" :active-color="useColor('theme')" custom-class="w-full py-20">
          <view class="font-28 text-price">-￥{{ vipDiscount }}</view>
          <zm-icon slot="icon" name="check" color="#fff" size="28rpx" weight="bold"></zm-icon>
        </u-radio>
      </u-radio-group>
      <view slot="footer" class="px-34 mb-20">
        <zm-button height="100rpx" text-size="32rpx" text-weight="bold" round @click="handleVipDiscount">确定</zm-button>
      </view>
    </zm-popup>
  </zm-view>
</template>

<script>
import discount from "./mixins/discount"
import vip from "./mixins/vip"
import page from "@/mixins/page"
import deductCell from "@/components/deduct-cell/deduct-cell"
import orderDetailCell from "./components/order-detail-cell"
import payWayPopup from "@/components/pay-way-popup/pay-way-popup"
import { mapGetters, mapActions } from "vuex"
import manifest from "@/manifest.json"
export default {
  components: {
    deductCell,
    orderDetailCell,
    payWayPopup
  },
  mixins: [discount, page, vip],
  data() {
    return {
      isInit: false,
      manifest,
      activityId: "",
      zoneId: "",
      orderId: "",
      newMobile: "",
      isAgreest: false,
      footerHeight: "auto",
      detailVisible: false,
      backEditVisible: false,
      showMobileDialog: false,
      backEditDialogVisible: false,
      preInfo: {}, // 预支付信息
      cardCanUseNum: 0,
      // 订单信息
      orderInfo: {
        cinemaInfo: {
          address: ""
        },
        discountList: [],
        seatList: []
      }
    }
  },

  computed: {
    ...mapGetters(["channelInfo", "baseInfo", "isVip", "checkVip", "webEvn"]),
    // 购买的影票数量
    ticketNum() {
      return this.orderInfo?.ticketNum
    },

    // 获取电影卡可以抵扣座位数
    cardUseTicketNum() {
      if (this.checkCouponTemp?.coupons?.length > 0) {
        const needPaySeat = this.checkCouponTemp.coupons.filter((i) => !i.couponId && +i.finalPrice > 0)
        return needPaySeat.length
      } else {
        return this.orderInfo?.ticketNum
      }
    },
    allNeedPayPrice() {
      // 会员卡购买要单独支付，总支付金额要加上开卡价格
      return this.$u.plus(this.filmNeedPrice, this.vipCardPrice)
    },
    filmNeedPrice() {
      // 还需要支付的价格（扣除卡券）
      const cardMoney = this.cardInfo.money || 0 // 卡抵用价格
      const couponMoney = this.caclFilmCoupon() // 券抵用价格
      const money = this.$u.minus(this.prePrice, cardMoney, couponMoney)
      return money < 0 ? 0 : money
    },
    prePrice() {
      // 原本要支付金额的原价  （影片价格 +  其他）
      return this.filmPrice
    },
    originPrice() {
      //影票展示价格 防止原价小于售价
      return +this.orderInfo.asPrice >= +this.orderInfo.salePrice ? this.orderInfo.asPrice : this.orderInfo.salePrice
    },

    filmPrice() {
      // 原本要支付的影票价格
      return +this.orderInfo?.salePrice
    },
    payButtonText() {
      if (this.webEvn == "ibl") {
        if (this.filmNeedPrice > 0) {
          return "无法兑换"
        }
      }
      return "立即付款"
    },
    payButtonDisabled() {
      if (this.webEvn == "ibl") {
        return this.filmNeedPrice > 0
      }
      return !this.isInit
    }
  },

  onLoad(options) {
    this.activityId = options.activityId || ""
    this.orderId = options.orderId
    this.cinemaId = options.cinemaId
    this.zoneId = options.zoneId || ""
    this.checkReset()
    this.handleShowBackEditDialog()
    this.handleGetHeightVipCardInfo()
  },
  onShow() {
    this.init()
  },
  methods: {
    async init() {
      this.handleBackPage()
      // 获取最新卡券规则信息
      this.$store.dispatch("getBaseInfo")
      // 获取可用券数量
      this.getUsableCount()
      // 订单信息
      this.getOrderInfo()
      // 处理选中后的卡券
      this.handelCoupon()
    },
    handleBackPage() {
      // 已经提交支付，又取消支付回到该页面，需要跳转去订单详情页
      const isSubmitPay = uni.$getCache("payStatus") == 1
      if (isSubmitPay || uni.$leaveRoute == "pages/pay/wait/wait") {
        this.toView({
          url: "pages/order/order-film-info/order-film-info",
          type: "reLaunch",
          params: {
            orderId: this.orderId
          }
        })
      }
    },

    // 修改绑定手机号
    async handleConfirmMobile() {
      if (!uni.$check.isPhoneNo(this.newMobile)) {
        uni.$toast({ type: "error", content: "手机号格式错误" })
      } else {
        await uni.$api.orderFilm.updateLockMobile({ orderId: this.orderId, lockMobile: this.newMobile })
        this.getOrderInfo()
        uni.$toast({ type: "success", content: "修改成功" })
      }
    },
    // 清除之前的缓存
    checkReset() {
      this.clearCheckCoupon()
      this.clearCheckCard()
      this.clearCheckVip()
    },
    // 重置预支付信息
    preInfoReset() {
      this.cardInfo = {}
      this.coupons = []
      this.checkCouponTemp = []
      this.createPreInfo()
    },
    // 判断显示是否显示退改签弹窗
    handleShowBackEditDialog() {
      setTimeout(() => {
        if (+this.channelInfo.showRule == 0) return
        const refundAgreementConfig = uni.$getCache("refundAgreementConfig")
        if (refundAgreementConfig) {
          this.isAgreest = refundAgreementConfig.agree ? true : false
          if (this.channelInfo.isRefundTag) {
            const diff = uni.$diffDate(refundAgreementConfig.date, new Date())
            // 检查逻辑
            const checkLogic = {
              4: () => diff.days >= 1, // 每天
              3: () => true, // 每次
              2: () => diff.months >= 1, // 每月
              1: () => diff.days >= 7, // 每周
              0: () => false // 不弹
            }
            this.backEditDialogVisible = checkLogic[this.channelInfo.showRule]?.()
          } else {
            this.backEditDialogVisible = true
          }
        } else {
          this.backEditDialogVisible = true
        }
      }, 1000)
    },
    // 退改签弹窗确认
    onBackEditDialogConfirm({ close, done }) {
      if (this.isAgreest) {
        uni.$setCache("refundAgreementConfig", { date: uni.$dayJs().format("YYYY-MM-DD"), agree: true })
        close()
      } else {
        done()
        uni.$toast("请勾选协议")
      }
    },
    // 退改签弹窗取消
    onBackEditDialogCancel({ close }) {
      close()
      uni.navigateBack()
    },

    // 订单信息
    getOrderInfo() {
      // 已经支付过不在刷新订单信息防止出现超时问题
      if (uni.$getCache("payStatus") == 1 || uni.$leaveRoute == "pages/pay/wait/wait") return
      uni.$api.orderFilm.getOrderFilmInfo({ orderId: this.orderId, vipCardId: this.checkVipCardV2Info.vipCardId }).then((res) => {
        this.isInit = true
        res.autoTime == 0 && this.timeFinish()
        this.orderInfo = res
        this.newMobile = res.lockMobile
        // 去除不显示支付项
        const keys = ["surplusPrice", "businessServicePrice"]
        this.orderInfo.otherPayInfo = res.otherPayInfo?.filter((item) => !keys.includes(item.k))
        // 首单立减信息
        this.vipForm.vipFirstDiscount = res.discountType
        this.formVipFirstDiscount = res.discountType
        // 订单信息
        this.$store.commit("SET_ORDER_INFO", this.orderInfo)
        // 可支付方式
        const list = this.orderInfo.ownPayList.map((i) => i.key)
        this.$store.commit("SET_OWN_PAY_LIST", list)
      })
    },

    // 获取影片票优惠券折扣价
    caclFilmCoupon() {
      return this.coupons.length ? +this.checkCouponTemp.couponCost : 0
    },
    // 点击卡券选择，跳转前数据处理
    handleChooseCell(type) {
      const checkParams = {
        filmPrice: this.filmPrice,
        orderId: this.orderId,
        prePrice: this.prePrice
      }
      if (type == "coupon") {
        checkParams.type = "coupon"
        checkParams.maxLen = this.ticketNum
        checkParams.couponIds = this.coupons
          .map((i) => i.couponId)
          .filter((i) => i)
          .join(",")
      } else if (type == "card") {
        checkParams.cardDisabled = this.cardUseTicketNum <= 0
        let sortSeatPriceList = this.orderInfo.seatList.sort((a, b) => {
          return +a.salePrice - +b.salePrice
        })
        if (this.checkCouponTemp.length > 0) {
          const needPayList = this.checkCouponTemp.filter((i) => i.salePrice)
          sortSeatPriceList = needPayList.sort((a, b) => {
            return +a.salePrice - +b.salePrice
          })
        }
        checkParams.prePrice = this.caclFilmCoupon() > this.prePrice ? 0 : this.$u.minus(this.prePrice, this.caclFilmCoupon())
        checkParams.maxLen = this.cardUseTicketNum
        checkParams.cardId = this.cardInfo.cardId
        checkParams.coupons = this.checkCouponTemp.coupons
        checkParams.salePrice = +sortSeatPriceList[0].salePrice
        this.orderInfo.vipCardPrice = this.vipCardPrice
        this.$store.commit("SET_ORDER_INFO", this.orderInfo)
      } else if (type == "vip") {
        this.vipDiscountVisible = true
        return
      }
      this.$store.commit("SET_CHECK_PARAMS", checkParams)
      this.toView({
        url: `pages/pay/${type}-list/${type}-list`,
        params: {
          orderId: this.orderId
        }
      })
    },
    // 选中卡券后计算补差
    handelCoupon() {
      // if (uni.$leaveRoute == "pages/pay/card-list/card-list") {
      // 处理选中电影卡
      if (this.checkCard.submit) {
        this.cardInfo = this.checkCard
        if (!this.couponCardMergeUse && this.coupons.length) {
          this.coupons = []
          this.checkCouponTemp = []
          this.clearCheckCoupon()
          uni.$toast("卡券不可同时使用")
        }
      }
      // } else if (uni.$leaveRoute == "pages/pay/coupon-list/coupon-list") {
      if (this.checkCoupon.submit) {
        // 最新选择的
        const couponIds = this.checkCoupon.coupons.filter((i) => i.couponId)
        let flag = false
        let obj = {}
        this.coupons.forEach((item) => (obj[item.couponId] = item.couponId))
        couponIds.map((item) => {
          if (!obj[item.couponId]) {
            flag = true
          }
        })
        if (this.cardInfo.cardId && (couponIds.join(",") !== this.coupons.join(",") || flag)) {
          const tip = !this.couponCardMergeUse ? "卡券不可同时使用" : "优惠规则已变更，请重新选卡"
          uni.$toast(tip)
          this.cardInfo = {}
        }
        this.coupons = couponIds
        this.checkCouponTemp = this.checkCoupon
        if (!this.couponCardMergeUse) {
          this.cardInfo = {}
        }
        this.clearCheckCoupon()
      }

      // }
      this.clearCheckCard()
      // 卡券选择后重新计算卡的可用数量
      this.getCardByOrderFilm()
      this.preInfo = this.createPreInfo()
    },
    // 可用券和卡数量
    getUsableCount() {
      uni.$api.orderFilm.getUsableCount({ orderId: this.orderId }).then((res) => {
        this.couponCount = res
      })
    },
    // 获取卡列表(卡券选择后重新计算卡的可用数量)
    getCardByOrderFilm() {
      uni.$api.card.getCardByOrderFilm({ orderId: this.orderId }).then((res) => {
        // 可用的卡数
        if (res.length > 0) {
          // (不可用 || 不可补差且座位数被券抵扣完)取反后为可用卡
          const canUseList = res.filter((item) => {
            return !(!item.usable || (item.isCashDiff == "0" && this.cardUseTicketNum <= 0))
          })
          this.cardCanUseNum = canUseList.length
        }
      })
    },
    // 查看价格明细
    lookDetail() {
      this.backEditVisible = false
      this.detailVisible = !this.detailVisible
      this.createPreInfo()
    },
    // 支付时间结束
    timeFinish() {
      uni.$dialog({
        title: "支付超时",
        content: "付款超时，请返回选座页重新选座购买",
        onConfirm: () => {
          uni.$setCache("time-out", true)
          uni.navigateBack()
        }
      })
    },
    // 下单
    submitPay() {
      this.detailVisible = false
      const preInfo = this.createPreInfo()
      if (this.webEvn == "ibl") {
        if (this.filmNeedPrice > 0) {
          uni.$toast("券数量不够,无法兑换,请重新选择座位!")
          return
        }
      }
      this.$refs.pay.open({
        orderType: "film",
        zoneId: this.zoneId,
        activityId: this.activityId,
        cinemaId: this.cinemaId,
        filmOrderId: this.orderId,
        preInfo,
        fail: (e) => {
          this.toView({
            url: "pages/order/order-film-info/order-film-info",
            type: "reLaunch",
            params: {
              orderId: e.orderId
            }
          })
        }
      })
    },

    createPreInfo() {
      // 生成预下单信息，用于回显数据和表单提交
      const cardInfo = uni.$clone(this.cardInfo)
      const cutReduce = this.$u.minus(this.filmPrice, this.caclFilmCoupon(), +this.cardInfo.money || 0)
      const preInfo = {
        orderId: this.orderId,
        film: {
          filmPrice: this.filmPrice, // 影片总价
          vipCardPrice: this.vipCardPrice, // vip卡价格
          cardInfo: cardInfo, // 电影卡
          coupons: this.coupons, // 影票信息
          saleOrderNo: this.checkCouponTemp.saleOrderNo, // 会员销售单
          couponsDiscount: this.caclFilmCoupon(),
          checkVipCardV2Info: this.checkVipCardV2Info, // 购买vip卡信息
          discount: cutReduce < 0 ? 0 : cutReduce, // 影片用券卡后的价格
          otherPayInfo: this.orderInfo.otherPayInfo || []
        },
        realNameIds: "",
        allNeedPayPrice: this.allNeedPayPrice,
        needPay: this.filmNeedPrice
      }
      this.preInfo = uni.$clone(preInfo)
      return preInfo
    },
    onFooterHeight(v) {
      this.footerHeight = v
    },
    handleToBackEditAt() {
      uni.$setCache("richtext", { content: this.channelInfo.refundAgreement, title: `${this.baseInfo.priSubject || this.manifest.name}退票改签用户服务协议` })
      uni.$toView("pages/utils/richtext/richtext")
    },

    ...mapActions(["clearCheckCoupon", "clearCheckCard", "clearCheckVip"])
  }
}
</script>

<style lang="scss" scoped>
.ticket {
  &-detail {
    &_image {
      width: 156rpx;
      height: 224rpx;
      border-radius: 10rpx;
    }
  }
  .refund-tips {
    position: relative;
    .lint {
      top: 0;
      left: 24rpx;
      right: 24rpx;
      position: absolute;
      border-top: 1rpx solid #eee;
    }
    &::after,
    &::before {
      top: -12rpx;
      width: 24rpx;
      height: 24rpx;
      content: "";
      position: absolute;
      border-radius: 50%;
      background-color: var(--page-color);
    }
    &::after {
      left: -12rpx;
    }
    &::before {
      right: -12rpx;
    }
  }
}
</style>
